<!--

django-codenerix

Codenerix GNU

Project URL : http://www.codenerix.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<div class="row clearfix block-top" ng-clock>
    <div class="col-md-12 column ">
        <div class="form-inline panelfilters panelfilters-top" role="form">
            <div class="panel panel-default pull-right">
                <div class="panel-body listfilters"
                    ng-mouseover="pagination_flag=true"
                    ng-mouseleave="pagination_flag=false"
                    ng-init="pagination_flag=false">
                    <div class="pull-right" ng-if="!data.meta.vtable && data.meta.row_total && data.meta.rowsperpageallowed"><!-- ROWS {{{1 -->
                        <div class='center-block'>
                            <ul class="pagination pagination-sm">
                                <li><a href="#" popover-placement="top" uib-popover="{{data.meta.gentranslate.RowsPerPage}}" popover-trigger="mouseenter"><span class="glyphicon glyphicon-th-list"></span></a></li>
                                <li class="choice"
                                    ng-repeat='(rowsperpage, label) in data.meta.rowsperpageallowed'
                                    ng-class="{active:rowsperpage==data.meta.rowsperpage || data.meta.rowsperpageallowed.length==1}"
                                    ng-click="rows_change(rowsperpage)"
                                    ng-hide="(!pagination_flag) && (rowsperpage!=data.meta.rowsperpage) && (data.meta.rowsperpageallowed.length!=1)"><a>{{label}}</a></li>
                                <li class="choice" ng-hide="(pagination_flag) || (data.meta.rowsperpageallowed.length==1)"><a>...</a></li>
                            </ul>
                        </div>
                    <!--}}}1--></div>
                    <div class="pull-right" ng-if="!data.meta.vtable && data.meta.pages"><!-- PAGINATION {{{1-->
                        <div class='center-block'>
                            <ul class="pagination pagination-sm">
                                <li><a href="#" popover-placement="top" uib-popover="{{data.meta.gentranslate.PageNumber}}" popover-trigger="mouseenter"><span class="glyphicon glyphicon-list-alt"></span></a></li>
                                <li class="choice"
                                    ng-repeat="page in data.meta.pages"
                                    ng-class="{active:page==data.meta.page}"
                                    ng-click="page_change(page)"
                                    ng-hide="(!pagination_flag) && (page!=data.meta.page)"><a>{{page}}</a></li>
                                <li class="choice" ng-hide="(pagination_flag) || (data.meta.rowsperpageallowed.length==1)"><a>...</a></li>
                            </ul>
                        </div>
                    </div><!--}}}1-->
                    <div class="pull-right"><!-- RESULT {{{1 -->
                        <h5 class="text-right text-nowrap results">
                            <strong>{{data.meta.row_total}} {{data.meta.gentranslate.registers}}<span ng-if="!data.meta.vtable && data.meta.row_last"> [ {{data.meta.row_first}} - {{data.meta.row_last}} ]</span></strong>
                        </h5>
                <!--}}}1--></div>
                </div>
            </div>
            <div class="panel panel-default pull-left">
                <div class="panel-body listfilters">
                    <div class="pull-left" ng-if='data.meta.linkadd'><!-- ADD {{{1 -->
                        <div class="input-group input-group-sm">
                            <button type="button" class="btn btn-primary btn-sm btn-add" popover-placement="top" uib-popover="{{data.meta.gentranslate.Add}}" popover-trigger="mouseenter" ng-click="addnew()">
                                <span class="glyphicon glyphicon-plus"></span>
                                {{data.meta.gentranslate.Add}}
                            </button>
                        </div>
                    <!-- }}}1 --></div>
                    <div class="pull-left"><!-- SEARCH {{{1-->
                        <form name="search" ng-submit="refresh()" role="form">
                            <div class="input-group input-group-sm">
                                <input type="text" class="form-control input-sm" ng-model="data.filter.search" codenerix-focus='focus.search_box'>
                                <span class="input-group-btn">
                                    <button type="button" class="btn btn-default btn-sm" ng-click="refresh()" popover-placement="top" uib-popover="{{data.meta.gentranslate.Search}}" popover-trigger="mouseenter">
                                        <span class="glyphicon glyphicon-search"></span>
                                    </button>
                                </span>
                                <span class="input-group-btn">
                                    <button type="button" class="btn btn-default btn-sm" ng-class="{'btn-default':!data.meta.search_filter_button,'btn-info':data.meta.search_filter_button}" ng-click="data.meta.search_filter_button=!data.meta.search_filter_button" popover-placement="top" uib-popover="{{data.meta.gentranslate.Filters}}" popover-trigger="mouseenter">
                                        <span class="fa fa-sliders" ng-class="{'fa-inverse':data.meta.search_filter_button}"></span>
                                    </button>
                                </span>
                                <span class="input-group-btn">
                                    <button type="button" class="btn btn-default btn-sm" ng-click="reset_filter()" popover-placement="top" uib-popover="{{data.meta.gentranslate.CleanFilters}}" popover-trigger="mouseenter">
                                        <span class="fa fa-refresh"></span>
                                    </button>
                                </span>
                                <span ng-if="data.meta.export_excel" class="input-group-btn">
                                    <button type="button" class="btn btn-default btn-sm" ng-click="print_excel()" popover-placement="top" uib-popover="{{data.meta.gentranslate.PrintExcel}}" popover-trigger="mouseenter">
                                        <span class="fa fa-file-excel-o"></span>
                                    </button>
                                </span>
                                <span ng-if="data.meta.export_csv" class="input-group-btn">
                                    <button type="button" class="btn btn-default btn-sm" ng-click="print_csv()" popover-placement="top" uib-popover="{{data.meta.gentranslate.PrintCSV}}" popover-trigger="mouseenter">
                                        <span class="fa fa-file-excel-o"></span>
                                    </button>
                                </span>
                                <span ng-if="data.meta.export_json" class="input-group-btn">
                                    <button type="button" class="btn btn-default btn-sm" ng-click="print_json()" popover-placement="top" uib-popover="{{data.meta.gentranslate.PrintJSON}}" popover-trigger="mouseenter">
                                        <span class="fa fa-file-code-o"></span>
                                    </button>
                                </span>
                                <span ng-if="data.meta.export_jsonl" class="input-group-btn">
                                    <button type="button" class="btn btn-default btn-sm" ng-click="print_jsonl()" popover-placement="top" uib-popover="{{data.meta.gentranslate.PrintJSONL}}" popover-trigger="mouseenter">
                                        <span class="fa fa-file-text-o"></span>
                                    </button>
                                </span>
                                <span ng-if="data.meta.export_bson" class="input-group-btn">
                                    <button type="button" class="btn btn-default btn-sm" ng-click="print_bson()" popover-placement="top" uib-popover="{{data.meta.gentranslate.PrintBSON}}" popover-trigger="mouseenter">
                                        <span class="fa fa-file-archive-o"></span>
                                    </button>
                                </span>
                            </div>
                        </form>
                    <!--}}}1--></div>
                    <div class="pull-left" ng-if="data.meta.ngincludes.extracontrol">
                        <div class="input-group input-group-sm">
                            <ng-include src="data.meta.ngincludes.extracontrol"></ng-include>
                        </div>
                    </div>
                    <div class="pull-left" ng-if="data.filter.date"><!-- DATE {{{1-->
                        <div class="btn-group btn-group-sm">
                            <button class="btn btn-default btn-sm" popover-placement="top" uib-popover="{{data.meta.gentranslate.Date}}" popover-trigger="mouseenter" type="button" ng-click="date_change('year')"><span class="glyphicon glyphicon-calendar"></span></button>
                            <button class="btn btn-default btn-sm" popover-placement="top" uib-popover="{{data.meta.gentranslate.Year}}" popover-trigger="mouseenter" type="button" ng-if="data.filter.date.rightnow.year" ng-click="date_change('year')">{{data.filter.date.rightnow.year}}</button>
                            <button class="btn btn-default btn-sm" popover-placement="top" uib-popover="{{data.meta.gentranslate.Month}}" popover-trigger="mouseenter" type="button" ng-if="data.filter.date.rightnow.month" ng-click="date_change('month')">{{data.filter.date.rightnow.month}}</button>
                            <button class="btn btn-default btn-sm" popover-placement="top" uib-popover="{{data.meta.gentranslate.Day}}" popover-trigger="mouseenter" type="button" ng-if="data.filter.date.rightnow.day" ng-click="date_change('day')">{{data.filter.date.rightnow.day}}</button>
                            <button class="btn btn-default btn-info btn-xs" popover-placement="top" uib-popover="{{data.filter.date.deepname}}" popover-trigger="mouseenter" type="button" ng-repeat="token in data.filter.date.data" ng-click="date_select(data.filter.date.deepness,token)" ng-if="data.filter.date.deepness && data.filter.date.data.length && !data.filter.date.rightnow.day">{{token}}</button>
                        </div>
                        <div class="btn-group btn-group-sm" ng-if="data.filter.date.rightnow.day">
                            <button class="btn btn-default btn-sm" popover-placement="top" uib-popover="{{data.meta.gentranslate.Time}}" popover-trigger="mouseenter" type="button" ng-click="date_change('hour')"><span class="glyphicon glyphicon-time"></span></button>
                            <button class="btn btn-default btn-sm" popover-placement="top" uib-popover="{{data.meta.gentranslate.Hour}}" popover-trigger="mouseenter" type="button" ng-if="data.filter.date.rightnow.hour" ng-click="date_change('hour')">{{data.filter.date.rightnow.hour}}</button>
                            <button class="btn btn-default btn-sm" popover-placement="top" uib-popover="{{data.meta.gentranslate.Minute}}" popover-trigger="mouseenter" type="button" ng-if="data.filter.date.rightnow.minute" ng-click="date_change('minute')">{{data.filter.date.rightnow.minute}}</button>
                            <button class="btn btn-default btn-sm" popover-placement="top" uib-popover="{{data.meta.gentranslate.Second}}" popover-trigger="mouseenter" type="button" ng-if="data.filter.date.rightnow.second" ng-click="date_change('second')">{{data.filter.date.rightnow.second}}</button>
                            <button class="btn btn-default btn-info btn-xs" popover-placement="top" uib-popover="{{data.filter.date.deepname}}" popover-trigger="mouseenter" type="button" ng-repeat="token in data.filter.date.data" ng-click="date_select(data.filter.date.deepness,token)" ng-if="data.filter.date.deepness && data.filter.date.data.length">{{token}}</button>
                        </div>
                    <!--}}}1--></div>
                </div>
            </div>
            <div class="panel panel-default pull-left" ng-if="data.filter.subfilters.length">
                <div class="panel-body listfilters bg-warning">
                    <div class="pull-left column" ng-repeat="filter in data.filter.subfilters"><!-- FILTERS {{{1 -->
                        <form name="search" ng-submit="refresh()" autocomplete="off" role="form">
                            <div class="input-group input-group-sm">
                                <div ng-if="filter.kind!='checkbox'" class="input-group-addon"><span class="glyphicon glyphicon-eye-open" popover-placement="top" uib-popover="{{filter.name}}" popover-trigger="mouseenter"></span></div>
                                <input name='filter.choosen' ng-model='filter.choosen' type='hidden'>
                                <ui-select multiple ng-model="$parent.filter.choosen" theme="bootstrap"
                                    on-select="saveSelected(options['filter.choosendyn'], filter.choosen);selectedOptionSelect(search,filter.choice);"
                                    ng-init="options['filter.choosendyn']=filter.choices"
                                    on-remove="removeSelected(filter.choosen)"
                                    reset-search-input="true"
                                    ng-disabled="disabled"
                                    ng-if="filter.kind=='multidynamicselect'"
                                    ng-change="saveSelected(options['filter.choosendyn'], filter.choosen);refresh()">
                                        <ui-select-match placeholder="">
                                        </ui-select-match>
                                        <ui-select-choices
                                            repeat="value.id as value in options['filter.choosendyn']"
                                            refresh="getForeignKeys(http,filter.choicedynamic[1],options, multi_dynamic_select_dict(filter.choicedynamic.slice(2),'search'),'filter.choosendyn',filter.choosen,$select.search, filter.choicedynamic[0])"
                                            refresh-delay="0">
                                            <div ng-bind-html="value.label| highlightSelect: $select.search">
                                                {{ value.label }}
                                            </div>
                                        </ui-select-choices>
                                </ui-select>


                                <ui-select multiple ng-model="filter.choosen" theme="bootstrap"
                                        on-select="selectedOptionSelect(search,filter.choice)"
                                        ng-init="filter.choice; $select.selected=options.filter.choosen; search.filter.choosen.$setViewValue(filter.choice);"
                                        name = "filter.choosen"
                                        reset-search-input="true"
                                        ng-disabled="disabled"
                                        ng-if="filter.kind=='multiselect'"
                                        ng-change="refresh()">
                                    <ui-select-match placeholder="">{{$item.label}}</ui-select-match>
                                    <ui-select-choices repeat="value.id as value in filter.choice | filter: {label: $select.search}">
                                        <div ng-bind-html="value.label| highlightSelect: $select.search">
                                            {{ value.label }}
                                        </div>
                                    </ui-select-choices>
                                </ui-select>
                                <select ng-if="filter.kind=='select'" class="form-control input-sm" ng-model="filter.choosen" ng-change="refresh()">
                                    <option ng-repeat='entry in filter.choice' value='{{$index}}' ng-selected='$index==filter.choosen'>{{entry}}</option>
                                </select>
                                <input ng-if="filter.kind=='input'" type="text" class="form-control input-sm" ng-model="filter.value">
                                <button ng-if="filter.kind=='input'" ng-hide="true" type="button" class="form-control btn btn-default btn-sm" ng-click="refresh()"><span class="glyphicon glyphicon-search"></span></button>
                                <input ng-if="filter.kind=='daterange'" date-range-picker type="text" class="form-control input-sm date-picker" ng-change="refresh()" ng-model="filter.value">
                                <label class="checkbox inline" for="filter.value">{{filter.name}}
                                    <input type="checkbox" ng-if="filter.kind=='checkbox'" ng-true-value="1" ng-click="refresh()" value="1" ng-model="filter.value" id="filter.value" />
                                </label>
                            </div>
                        </form>
                    <!--}}}1--></div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="row clearfix block-center">
    <div class="col-md-12 column">
        <div class="row clearfix">
            <div class="col-md-12 column table-responsive">
                <ng-include src="data.meta.ngincludes.table"></ng-include>
            </div>
        </div>
    </div>
</div>

<div class="row clearfix block-bottom" ng-clock>
    <div class="col-md-12 column ">
        <div class="form-inline panelfilters panelfilters-bottom" role="form">
            <div class="panel panel-default pull-right">
                <div class="panel-body listfilters">
                    <div class="pull-right" ng-if="!data.meta.vtable && data.meta.row_total && data.meta.rowsperpageallowed.length"><!-- ROWS -->
                        <div class='center-block'>
                            <ul class="pagination pagination-sm">
                                <li><a href="#" popover-placement="top" uib-popover="{{data.meta.gentranslate.RowsPerPage}}" popover-trigger="mouseenter"><span class="glyphicon glyphicon-th-list"></span></a></li>
                                <li class="choice"
                                    ng-repeat='rowsperpage in data.meta.rowsperpageallowed'
                                    ng-class="{active:rowsperpage==data.meta.rowsperpage || data.meta.rowsperpageallowed.length==1}"
                                    ng-click="rows_change(rowsperpage)"
                                    ><a>{{rowsperpage}}</a></li>

                            </ul>
                        </div>
                    </div>
                    <div class="pull-right" ng-if="!data.meta.vtable && data.meta.pages"><!-- PAGINATION -->
                        <div class='center-block'>
                            <ul class="pagination pagination-sm">
                                <li><a href="#" popover-placement="top" uib-popover="N&uacute;mero de p&aacute;gina" popover-trigger="mouseenter"><span class="glyphicon glyphicon-list-alt"></span></a></li>
                                <li class="choice"
                                    ng-repeat="page in data.meta.pages"
                                    ng-class="{active:page==data.meta.page}"
                                    ng-click="page_change(page)"><a>{{page}}</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="pull-right"><!-- RESULT -->
                        <h5 class="text-right text-nowrap results">
                            <strong>{{data.meta.row_total}} {{data.meta.gentranslate.registers}}<span ng-if="!data.meta.vtable && data.meta.row_last"> [ {{data.meta.row_first}} - {{data.meta.row_last}} ]</span></strong>
                        </h5>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
